#pragma once

#include "task_base.h"
#include "application/vehicle/vehicle_service.h"
#include "application/map/map_application_service.h"
#include "application/map/lift/base_lift.h"
#include <memory>
#include <QString>

namespace application {
namespace task {

struct LiftContext {
    std::shared_ptr<vehicle::VehicleService> vehicleService;
    std::shared_ptr<MapApplicationService> mapService;
    std::shared_ptr<lift::BaseLift> lift;
    lift::FloorInfo callFloorInfo;
    lift::FloorInfo targetFloorInfo;
    QString callMapName;
    QString targetMapName;
    int liftNum{0};
    int callFloor{0};
    int targetFloor{0};
};

class BaseLiftStrategy {
public:
    explicit BaseLiftStrategy(std::shared_ptr<kernel::ILogger> logger)
        : m_logger(std::move(logger)) {}
    virtual ~BaseLiftStrategy() = default;

    virtual bool init(LiftContext& context, TaskContext& taskCtx) = 0;
    virtual kernel::task::TaskStage run(TaskContext& taskCtx) = 0;
    virtual void cleanup(TaskContext& taskCtx) = 0;

protected:
    std::shared_ptr<kernel::ILogger> logger() const { return m_logger; }

private:
    std::shared_ptr<kernel::ILogger> m_logger;
};

std::unique_ptr<BaseLiftStrategy> createLiftStrategy(
    lift::LiftType type,
    std::shared_ptr<kernel::ILogger> logger);

} // namespace task
} // namespace application

